package org.delphy.indy2.controls
{
	import flash.events.FocusEvent;
	import flash.filters.GlowFilter;
	
	import mx.controls.TextArea;
	import mx.events.FlexEvent;

	public class CarbonTextArea extends TextArea
	{
		private var outterGlow:GlowFilter;
		
		public function CarbonTextArea()
		{
			super();
			
			styleName="carbonTextArea";

			outterGlow=new GlowFilter(0x6699cc,1,8,8);
			
			addEventListener(FlexEvent.CREATION_COMPLETE,onInit);
		}
		
		private function onInit(evt:FlexEvent):void{
			addEventListener(FocusEvent.FOCUS_IN,onFocusIn);
			addEventListener(FocusEvent.FOCUS_OUT,onFocusOut);			
		}
		
		private function onFocusIn(evt:FocusEvent):void{
			filters=[outterGlow];
		}
		private function onFocusOut(evt:FocusEvent):void{
			filters=[];
		}		
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
			super.updateDisplayList(unscaledWidth,unscaledHeight);
			
			outterGlow.color=getStyle("glowColor");

		}
		
	}
}